package com.ljx.itbbs.server.article.service.impl;

import com.ljx.itbbs.server.article.dao.LikeRecordDao;
import com.ljx.itbbs.server.article.domain.entity.LikeRecordEntity;
import com.ljx.itbbs.server.article.service.LikeRecordService;
import com.ljx.itbbs.server.article.service.adapter.ArticleAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LikeRecordServiceImpl implements LikeRecordService {

    @Autowired
    private LikeRecordDao likeRecordDao;

    @Override
    public LikeRecordEntity getLikeRecord(String objKey, Long userId) {
        return likeRecordDao.getLikeRecord(objKey, userId);
    }

    @Override
    public void saveLikeRecord(String objKey, Long userId,  Integer type) {
        likeRecordDao.save(ArticleAdapter.buildLikeRecordSave(objKey, userId, type));
    }

    @Override
    public void deleteListRecord(Long userId, String likeObj, Integer type) {
        likeRecordDao.deleteListRecord(userId, likeObj, type);
    }
}
